# $LastChangedDate: 2010-05-25 21:26:05 -0400 (Tue, 25 May 2010) $
# LEGAL: COPYRIGHT (C) 2010 JIM E. BROOKS WWW.PALOMINO3D.ORG
# Find zlib (gzip compression).
# ZLIB_FOUND
# ZLIB_INC_DIR
# ZLIB_LIBS
# Notes:
# - See module.txt.
#-------------------------------------------------------------------------------

INCLUDE( CMakeModules/inc_find.cmake )

#-------------------------------------------------------------------------------
# Find include directory : ZLIB_INC_DIR

FIND_PATH( ZLIB_INC_DIR
    NAMES zlib.h
    PATHS ${POSSIBLE_INC_DIRS}
          ${POSSIBLE_OSG_INC_DIRS}  # OSG 3rdParty provides zlib on Windows
)

#-------------------------------------------------------------------------------
# Find library : ZLIB_LIBS

FIND_LIBRARY( ZLIB_LIBS
    NAMES z zlib1
    PATHS ${POSSIBLE_LIB_DIRS}
          ${POSSIBLE_OSG_LIB_DIRS}  # OSG 3rdParty provides zlib on Windows
)

#-------------------------------------------------------------------------------
# Found everything?

IF( ZLIB_INC_DIR AND ZLIB_LIBS )
   SET( ZLIB_FOUND "TRUE" )
   MESSAGE( STATUS "Found ZLIB: ${ZLIB_LIBS}" )
ELSE()
    IF( ZLIB_FIND_REQUIRED )
        MESSAGE( FATAL_ERROR "Could not find ZLIB" )
    ENDIF()
ENDIF()
